# 构建动态库文件
set(SRC_LIST1 dir1.cc)
add_library(dir1_shared SHARED ${SRC_LIST1}) 

# 设置库属性
set_target_properties(dir1_shared PROPERTIES
    OUTPUT_NAME "dir1"
    SOVERSION 1
    VERSION 1.0.0
    PUBLIC_HEADER "dir1.h"
)

#设置包含目录,创建时候库文件的包含目录
target_include_directories(dir1_shared PUBLIC
#设置创建时候库文件的包含目录
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
#设置安装时候的包含路径
    $<INSTALL_INTERFACE:include>
)

# 安装配置
install(TARGETS dir1_shared
    EXPORT TopProjectTargets
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
    RUNTIME DESTINATION bin
    PUBLIC_HEADER DESTINATION include/topproject
)
